
ECHO OFF
CLS
SETLOCAL

SET INSTALLUTIL=%SystemRoot%\Microsoft.NET\Framework\v2.0.50727\InstallUtil.exe

IF "%1" == "" GOTO Usage
IF "%1" == "install" GOTO Install
IF "%1" == "remove" GOTO Remove
GOTO Usage

:Install
IF "%2" == "debug" GOTO InstallDebug
IF "%2" == "release" GOTO InstallRelease
GOTO Usage

:Remove
CALL :StopService
IF "%2" == "debug" GOTO RemoveDebug
IF "%2" == "release" GOTO RemoveRelease

GOTO Usage

:InstallDebug
ECHO Installing debug version.
ECHO %INSTALLUTIL% Bin\Debug\SimpleNetServer.exe
CALL :StartService
GOTO End

:InstallRelease
ECHO Installing release version.
ECHO %INSTALLUTIL% Bin\Release\SimpleNetServer.exe
CALL :StartService
GOTO End

:RemoveDebug
ECHO Uninstalling debug version.
ECHO %INSTALLUTIL% /U Bin\Debug\SimpleNetServer.exe
GOTO End

:RemoveRelease
ECHO Uninstalling release version.
ECHO %INSTALLUTIL% /U Bin\Release\SimpleNetServer.exe
GOTO End

:Usage
ECHO Configuration name required (Debug -or- Release)
GOTO End

:StopService
NET STOP SimpleNetServerSvc

:StartService
NET START SimpleNetServerSvc

:End

ENDLOCAL